Fix some cases where style functions were not handling widget == NULL
authorMatthias Clasen <mclasen@redhat.com>
Fri, 9 Jul 2004 14:40:36 +0000 (14:40 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 9 Jul 2004 14:40:36 +0000 (14:40 +0000)
2004-07-09  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkstyle.c: Fix some cases where style functions were
not handling widget == NULL properly.  (#146282)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkstyle.c

index c4e9986328e3ca64828157b8de27ba4220e90a42..3b56c6d76a78bb616c090650dc395100ee90ae3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-09  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkstyle.c: Fix some cases where style functions were 
+       not handling widget == NULL properly.  (#146282)
+
 Thu Jul  8 22:38:58 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.
index c4e9986328e3ca64828157b8de27ba4220e90a42..3b56c6d76a78bb616c090650dc395100ee90ae3b 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-09  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkstyle.c: Fix some cases where style functions were 
+       not handling widget == NULL properly.  (#146282)
+
 Thu Jul  8 22:38:58 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.
index c4e9986328e3ca64828157b8de27ba4220e90a42..3b56c6d76a78bb616c090650dc395100ee90ae3b 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-09  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkstyle.c: Fix some cases where style functions were 
+       not handling widget == NULL properly.  (#146282)
+
 Thu Jul  8 22:38:58 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.
index c4e9986328e3ca64828157b8de27ba4220e90a42..3b56c6d76a78bb616c090650dc395100ee90ae3b 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-09  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkstyle.c: Fix some cases where style functions were 
+       not handling widget == NULL properly.  (#146282)
+
 Thu Jul  8 22:38:58 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtktreeview.c: Improve the EXPANDER_MAX warning.
index 254d482d61e84498cc3a4e33d653607ca4ae76fc..1ffd101cb6625d7013ba35b66187494aecd3d2b4 100644 (file)
@@ -2562,6 +2562,20 @@ draw_menu_shadow (GtkStyle        *style,
                   x + 1, y + 1, x + 1, y + height - 3);
 }
 
+static GtkTextDirection
+get_direction (GtkWidget *widget)
+{
+  GtkTextDirection dir;
+  
+  if (widget)
+    dir = gtk_widget_get_direction (widget);
+  else
+    dir = GTK_TEXT_DIR_LTR;
+  
+  return dir;
+}
+
+
 static void
 gtk_default_draw_shadow (GtkStyle      *style,
                          GdkWindow     *window,
@@ -2604,8 +2618,8 @@ gtk_default_draw_shadow (GtkStyle      *style,
       if (widget && GTK_IS_SPIN_BUTTON (widget) &&
          detail && strcmp (detail, "spinbutton") == 0)
        {
-         draw_spinbutton_shadow (style, window, state_type,
-                                 gtk_widget_get_direction (widget), area, x, y, width, height);
+         draw_spinbutton_shadow (style, window, state_type, 
+                                 get_direction (widget), area, x, y, width, height);
          
          return;
        }
@@ -2842,7 +2856,7 @@ gtk_default_draw_shadow (GtkStyle      *style,
       widget && GTK_IS_SPIN_BUTTON (widget) &&
       detail && strcmp (detail, "entry") == 0)
     {
-      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+      if (get_direction (widget) == GTK_TEXT_DIR_LTR)
        {
          gdk_draw_line (window,
                         style->base_gc[state_type],
@@ -3409,7 +3423,7 @@ gtk_default_draw_box (GtkStyle      *style,
          width -= 3;
          height -= 2;
 
-         if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+         if (get_direction (widget) == GTK_TEXT_DIR_RTL)
            x += 2;
          else
            x += 1;
@@ -3421,7 +3435,7 @@ gtk_default_draw_box (GtkStyle      *style,
          width -= 3;
          height -= 2;
 
-         if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+         if (get_direction (widget) == GTK_TEXT_DIR_RTL)
            x += 2;
          else
            x += 1;
@@ -3495,7 +3509,7 @@ gtk_default_draw_box (GtkStyle      *style,
 
       sanitize_size (window, &width, &height);
 
-      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+      if (get_direction (widget) == GTK_TEXT_DIR_RTL)
        vline_x = x + indicator_size.width + indicator_spacing.left + indicator_spacing.right;
       else 
        vline_x = x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness;
@@ -5009,13 +5023,13 @@ gtk_default_draw_expander (GtkStyle        *style,
   switch (expander_style)
     {
     case GTK_EXPANDER_COLLAPSED:
-      degrees = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 180 : 0;
+      degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 180 : 0;
       break;
     case GTK_EXPANDER_SEMI_COLLAPSED:
-      degrees = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 150 : 30;
+      degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 150 : 30;
       break;
     case GTK_EXPANDER_SEMI_EXPANDED:
-      degrees = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 120 : 60;
+      degrees = (get_direction (widget) == GTK_TEXT_DIR_RTL) ? 120 : 60;
       break;
     case GTK_EXPANDER_EXPANDED:
       degrees = 90;